package com.itheima.health.exception;

import com.itheima.health.common.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author cfr
 * @date 2021/12/29
 * @TIME:16:43
 */
@RestControllerAdvice
@Slf4j
public class ExceptionControllerAdvice {
        //处理异常
    @ExceptionHandler(RuntimeException.class)
    public Result exFirst(RuntimeException ex){
        log.error("出现了Exception...");//给自己看
        ex.printStackTrace();
        return new  Result(false,"服务器繁忙,请稍后重试...");//给客户看
    }
}
